<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn"%>
<%@ taglib prefix="s" uri="/struts-tags"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
    
    <title>My JSP 'Orderdetail.jsp' starting page</title>
	
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">
	<link rel="stylesheet" type="text/css" href="<%=basePath%>/css/biaoge.css"/>
	<link href="swfupload/default.css" rel="stylesheet"/>
   <script type="text/javascript" src="jquery/js/jquery-1.8.2.js"></script> 
   	<script type="text/javascript" src="swfupload/swfupload.js"></script>
	<script type="text/javascript" src="swfupload/swfupload.queue.js"></script>
	<script type="text/javascript" src="swfupload/fileprogress.js"></script>
	<script type="text/javascript" src="swfupload/handlers5.js"></script>
  </head>
  <script type="text/javascript">
  function updatecost(orderid){
      var costname=document.getElementsByName("costname");
      var costmoney=document.getElementsByName("costmoney");
      var cosname="",cosmoney="";
     for(var i=0;i<costname.length;i++){
       cosname+=costname[i].value+",";
       cosmoney+=costmoney[i].value+",";
     }
      //alert(cosname+"   "+cosmoney+"  "+orderid);
      $.post(
       "updatelabelcost",
       {costname:cosname,costmoney:cosmoney,orderid:orderid},
       function(data){
       alert("修改成功");
       },
      "json"
      );
  }
  
  function aaaaa(){
    var wen=document.getElementById("wenjian").value;
   /*   var tt=wen.split(".");
     alert(tt[1]); */
  var objReg = new RegExp("[.]+(cdr)$", "gi");
  if(objReg.test(wen))
  {
   
    return true;
    }
    else{
    alert("文件格式不正确");
    return false;
    }
  }
  var swfu;
		window.onload = function() {
			var settings = {
				flash_url : "swfupload/swfupload.swf",
				upload_url: "upCDR1",
				//post_params: {"orderid":$("#orderid").val(),"username":$("#username").val(),"memo":$("#memo").val()},
				file_size_limit : "100 MB",
				file_post_name: "swfupload",
				file_types : "*.cdr;*.jpg;*.png;*.bmp;*.gif;*.jpeg",
				file_types_description : "All Files",
				file_upload_limit : 0,
				file_queue_limit : 0,
				custom_settings : {
					progressTarget : "fsUploadProgress",
					cancelButtonId : "btnCancel"
				},
				debug: false,

				// Button settings
				//button_image_url: "img/51.png",
				button_width: "80",
				button_height: "29",
				button_placeholder_id: "spanButtonPlaceHolder",
				button_text: '<span class="theFont">选取文件</span>',
				button_text_style: ".theFont { font-size: 16; }",
				button_text_left_padding: 12,
				button_text_top_padding: 3,
				
				// The event handler functions are defined in handlers.js
				file_queued_handler : fileQueued,
				file_queue_error_handler : fileQueueError,
				file_dialog_complete_handler : fileDialogComplete,
				upload_start_handler : uploadStart,
				upload_progress_handler : uploadProgress,
				upload_error_handler : uploadError,
				upload_success_handler : uploadSuccess,
				upload_complete_handler : uploadComplete,
				queue_complete_handler : queueComplete	// Queue plugin event
			};
				swfu = new SWFUpload(settings);
	     };
	     function upload (){
    			if(swfu.getFile(0)!=null){
    			var params = {"orderid":$("#orderid").val(),"username":$("#username").val(),"memo":$("#memo").val()};
    			   swfu.setPostParams(params);
    			   swfu.startUpload();
    			    /*$.post("upCDR1",
    			  {"orderid":$("#orderid").val(),"username":$("#username").val(),"memo":$("#memo").val()},
    			  function(data){
    			  
    			   }
    			  );*/
    			}else{
    			  $.post("upCDR1",
    			  {"orderid":$("#orderid").val(),"username":$("#username").val(),"memo":$("#memo").val()},
    			  function(data){
    			  alert("修改成功");
    			   }
    			  );
    			}
	     }
  </script>
  <body>
  <form id="form1">
  <table>
  <tr>
  <td>
 <div style="margin:60px 50px 150px 150px; ">
  <img alt="" src="${order.orderPic}"style="width:300px"/><br/>
</div>
</td>
<td>
  <div style="margin:30px 50px 150px 20px; ">
   用户名称：${order.userName}<br>
   订单名称：${order.orderTheme}<br>
   用户电话：${order.orderMobilePhone}&nbsp;&nbsp;${order.receiveTelephone}<br>
   快递信息：${order.orderFreight}<br>
   订单数量：${order.orderProductsCount}<br>
   订单总价：${order.orderTotalPrice}&nbsp;&nbsp;&nbsp;&nbsp;邮费：${order.postfee }<br>
   送货地址：${order.orderProvince}&nbsp;${order.orderCity}&nbsp;${order.orderAddress}<br>
   收件人：     ${order.orderName }<br/>
  	 买家留言：${order.orderContent}<br/><br/> 
   备注：<input type="text" value="${order.memo}" id="memo"/><br/>
<c:if test="${!empty order.stockoutReason}">
  此订单未发出！原因为：<font size="2" color="red">${order.stockoutReason}</font><br><br>
</c:if>

<c:if test="${!empty order.costFeedback}">
 工厂反馈内容是：<font size="2" color="blue">${order.costFeedback}</font><br>
  <c:forEach items="${maplist}" var="mapli">
     <input type="hidden" name="costname" value="${mapli.labelcostname}">${mapli.labelcostname}:
     <input type="text" style="width:100" name="costmoney" value="${mapli.labelcostmoney}" disabled="disabled"><br>
      </c:forEach>
      
</c:if>
<c:if test="${order.CDRurl!=null}">
Cdr:&nbsp;&nbsp;<img src="images/icon_dm.gif"/>${fn:substringAfter(order.CDRurl,'userCDR/') }
</c:if>
   <input type="hidden" name="orderid" value="${order.orderId}" id="orderid">
   <input type="hidden" name="username" value="${order.userName}" id="username">

			<div class="fieldset flash" id="fsUploadProgress" >
					<span class="legend"></span>
				</div>
			<div>
				<span id="spanButtonPlaceHolder"></span>
				<input id="btnCancel" type="button" value="删除未上传的文件" onclick="swfu.cancelQueue();" disabled="disabled" style="margin-left: 2px; font-size: 8pt; height: 29px;" />
				<input type="button" value="提交" onclick="upload()">
			</div>
		<%-- 	${wen}
			<s:actionerror/>
			<s:actionmessage/>	
			<s:fielderror key="wen"></s:fielderror>		 --%>
	<input type="button" onclick="javascript:history.back(-1);" value="返回"/>
	
	</div>
	</td>
	</tr>
	</table>	
	</form>		
  </body>
</html>
